﻿<%@ Page Language="C#" MasterPageFile="~/Layouts/List.Master" AutoEventWireup="true"
    Inherits="HHMMS.UI.Modules.PlanManager.PurchaseSuppliesPlanList" Title="采购计划物资信息列表" CodeBehind="PurchaseSuppliesPlanList.aspx.cs" %>

<asp:Content ContentPlaceHolderID="head" ID="idFormTitle" runat="server">
    <!-- title -->
</asp:Content>

<asp:Content ID="idContent" ContentPlaceHolderID="Content" runat="Server">   
    <!-- 搜索框 -->
    <div class="search" style="margin-top:2px;">     
        <web:search ID="GridSearch" GridViewId="SmartGridView1" runat="server">            
            <SearchConditionTemplate>                                       
                <table cellpadding="0" cellspacing="0" width="95%">
                  <tr>
			        			            
					</tr>
                </table>
            </SearchConditionTemplate>                      
        </web:search>
    </div>

    <div class="datalist">
        <!-- 标题头 -->
        <h2 style="height:30px;">采购计划物资信息列表</h2>
        <!-- 工具栏 -->
        <div class="toolbar"  style="height:30px;">
            <asp:LinkButton runat="server"
                OnClientClick="return openForm(this, 'Insert');" OnClick="SearchGrid">
                <span>
                    <img alt="" runat="server" src="~/Images/icon_new.gif" style="border: 0px" />新建
                </span>
            </asp:LinkButton>
        </div>
        <div class="datagrid"  style="clear:left;">    
            <!--------------------------- List Area --------------------------->
            <web:SmartGridView ID="SmartGridView1" runat="server" AutoGenerateColumns="False"
                Width="100%" DataKeyNames="DocId" DataSourceID="SmartDataSource1" PageSize="10">
                <Columns>   
                    <asp:BoundField DataField="DocId" HeaderText="所属审批单" SortExpression="DocId" ItemStyle-HorizontalAlign = "Left"  />
                    <asp:BoundField DataField="PartName" HeaderText="配件名称" SortExpression="PartName" ItemStyle-HorizontalAlign = "Left"  />
                    <asp:BoundField DataField="PartModel" HeaderText="配件型号规格" SortExpression="PartModel" ItemStyle-HorizontalAlign = "Left"  />
                    <asp:BoundField DataField="Unit" HeaderText="单位" SortExpression="Unit" ItemStyle-HorizontalAlign = "Left"  />
                    <asp:BoundField DataField="Count" HeaderText="计划采购数量" SortExpression="Count" ItemStyle-HorizontalAlign = "Left"  />
                    <asp:BoundField DataField="ApplyGroup" HeaderText="申请及使用班组" SortExpression="ApplyGroup" ItemStyle-HorizontalAlign = "Left"  />
                    <asp:BoundField DataField="MaterialPlanUser" HeaderText="材料计划员" SortExpression="MaterialPlanUser" ItemStyle-HorizontalAlign = "Left"  />
                    <asp:BoundField DataField="Demand" HeaderText="有关要求" SortExpression="Demand" ItemStyle-HorizontalAlign = "Left"  />
                    <asp:BoundField DataField="Remark" HeaderText="备注" SortExpression="Remark" ItemStyle-HorizontalAlign = "Left"  />
                    <asp:BoundField DataField="ArrivalDate" HeaderText="到货日期" SortExpression="ArrivalDate" ItemStyle-HorizontalAlign = "Center"  />
                    <asp:TemplateField HeaderText="操作">
                        <ItemStyle HorizontalAlign="Center" />
                        <HeaderStyle Wrap="False" HorizontalAlign="Center" />
                        <ItemTemplate>
                            <table width="46px">
                                <tr>                                    
                                    <td style="border: 0px solid #fff;">
                                        <asp:ImageButton runat="server" ToolTip="编辑" _ID='<%#Eval("DocId")%>'
                                            ImageUrl="~/images/com/dg_edit.gif" CausesValidation="False" OnClientClick="return openForm(this, 'Edit');" OnClick="RefreshGrid">
                                        </asp:ImageButton>
                                    </td>
                                    <td style="border: 0px solid #fff;">
                                        <asp:ImageButton runat="server" ToolTip="删除" ImageUrl="~/images/com/dg_del.gif" _ID='<%#Eval("DocId")%>'
                                            CausesValidation="False" OnClientClick="return confirm('您确认要删除吗?')" OnClick="DeletePurchaseSuppliesPlan">
                                        </asp:ImageButton>
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <PagerSettings />
                <EditRowStyle HorizontalAlign="Center" />
            </web:SmartGridView>
    
            <web:SmartSqlDataSource ID="SmartDataSource1" runat="server" SelectCommand="PlanManager.PurchaseSuppliesPlan.List" SelectCountCommand="PlanManager.PurchaseSuppliesPlan.List.Count"
                    DefaultSortExpression="DocId DESC" SelectCommandAutoPageWrap="true">
            </web:SmartSqlDataSource>
        </div>
    </div>

    <script type="text/javascript">
        function openForm(_this, action) {
            var url;

            // FormViewMode : Insert/Edit/ReadOnly
            var params = {FormViewMode: action }
            if (action == "Insert") {
                url = "PurchaseSuppliesPlanEdit.aspx";
                params.title = "采购计划物资信息新增";
            } else if (action == "Edit") {
                url = "PurchaseSuppliesPlanEdit.aspx";
                params.title = "采购计划物资信息编辑";
                params.DocId = _this.attributes["_ID"].value;
            } else if (action == "View") {
                url = "PurchaseSuppliesPlanEdit.aspx";
                params.title = "采购计划物资信息编辑";
                params.DocId = _this.attributes["_ID"].value;
            }

            var returnValue = showCenterModalDialog(buildUrl(url, params), 620, 500, null);

            return returnValue == "true";
        }       
    </script>

</asp:Content>